package com.globallogic.university.people;

import java.util.GregorianCalendar;

import org.testng.Assert;
import org.testng.annotations.Test;

public class PersonTest {
  @Test
  public void shouldSetFirstName() {
	  // given
	  String expected = "Studen";
	  Student stud1 = new Student(expected, "Doe");
	  
	  // when
	  stud1.setFirstName(expected);
	  
	  // then
	  Assert.assertEquals(stud1.getFirstName(), expected);
  }
  
  @Test
  public void shouldSetLastName() {
	  // given
	  String expected = "Holodez";
	  Student stud1 = new Student("John", expected);
	  
	  // when
	  stud1.setLastName(expected);
	  
	  // then
	  Assert.assertEquals(stud1.getLastName(), expected);
  }
  
  @Test
  public void shouldSetDateOfBirth() {
	  // given
	  int year = 1980;
	  int month = 10;
	  int dayOfMonth = 10;
	  
	  GregorianCalendar dateToSet = new GregorianCalendar();
	  dateToSet.set(year, month, dayOfMonth);
	  Student stud1 = new Student("John", "Doe");
	  
	  // when
	  stud1.setDateOfBirth(dateToSet);
	  
	  // then
	  String expected = String.format("%d/%d/%d", year, month, dayOfMonth);
	  Assert.assertEquals(stud1.getDateOfBirth(), expected);
  }
  
  

}
